using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Fated.SaveEngine;

namespace Fated.Character {
    public static class CurrentCharacter {
        private static PlayerIndex currentPlayer = PlayerIndex.One;
        private static PlayerCharacter currChar;
        public static void initialize() {
            currChar = new PlayerCharacter();
        }
        public static String Name {
            get { return currChar.Name; }
            set { currChar.Name = value; }
        }
        public static DateTime Birthdate {
            get { return currChar.Birthdate; }
            set { currChar.Birthdate = value; }
        }
        public static PlayerIndex CurrentPlayerIndex {
            get { return currentPlayer; }
            set { currentPlayer = value; }
        }
        public static double getAttribute(String attName) {
            double output = 0;
            currChar.getAttribute<double>(attName, ref output);
            return output;
        }
        public static void setAttribute(String attName, double value) {
            currChar.setAttribute(attName, value);
        }
        public static void SetClass(string name) {
            currChar.setClass(name);
        }
        public static void AddClass(string name) {
            currChar.addClass(name);
        }
        public static void RemoveClass(string name) {
            currChar.removeClass(name);
        }
        public static void addGold(int amount) {
            currChar.addGold(amount);
        }
        public static void addItem(String item, int amount) {
            currChar.addItem(item, amount);
        }
        public static Dictionary<string, object> Data {
            get { return currChar.ToJSON(); }
            set { currChar.setData(value); }
        }

        public static class AllyIterator {
            private static int counter = 0;
            public static void reset() {
                counter = 0;
            }
            public static bool hasNext() {
                return (counter < currChar.Allies.Count());
            }
            public static Dictionary<string, object> getNextAllyData() {
                return currChar.Allies.getAlly(counter++).ToJSON();
            }
        }

        public static void mergeAllyData(List<Dictionary<string, object>> inputData) {
            currChar.Allies.mergeData(inputData);
        }
    }
}
